<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/WEB-INF/template/template.xhtml">
	<ui:define name="content">
		<h:form>
			<div class="middle">
				<h:messages class="myError" id="errors"/>
				<h:outputText value="&lt;br/&gt;" escape="false" />
				<h3><h:outputText value="#{msg.OM_newuser_header}"/></h3>
				<h:outputText value="&lt;br/&gt;" escape="false" />
				
				</div>
						<br/>
				<div class="middle">
				<h:outputText id="confNewMessage" value="#{manageUserBean.createSuccessMessage}" styleClass="middle" style="color:#FF0000" ></h:outputText>
				
				</div>
				<h:panelGrid border="0" columns="2" class="table">
					
					<h:outputText value="#{msg.OM_newuser_name}"></h:outputText>
					<h:inputText value="#{manageUserBean.name}" id="name"
						required="true" disabled="#{mpb.page eq 'addUser'}"
						requiredMessage="#{msg.OM_newuser_requiredMessage1}"
						validatorMessage="#{msg.OM_newuser_validMessage1}" >
						<f:validateRegex pattern="^([A-Z]{1}[a-z]+[ ]?[-]?)+$" disabled="#{not mpb.page eq 'addUser'}" />
						<f:ajax render="username email"
							event="keyup" immediate="true">
						</f:ajax>

					</h:inputText>

					<h:outputText value="#{msg.OM_newuser_username}"></h:outputText>
					<h:inputText id="username" value="#{manageUserBean.username}"
						 required="true" disabled="#{mpb.page eq 'addUser'}"
						requiredMessage="#{msg.OM_newuser_requiredMessage2}">
						<f:validator validatorId="validators.UsernameValidator" disabled="#{not mpb.page eq 'addUser'}"/>
						<f:validator validatorId="validators.UsernameDuplicateValidator" disabled="#{not mpb.page eq 'addUser'}"/>
					</h:inputText>

					

					<h:outputText value="#{msg.OM_newuser_email}"></h:outputText>
					<h:inputText id="email" value="#{manageUserBean.email}"
						required="true" requiredMessage="#{msg.OM_newuser_requiredMessage3}"
						disabled="#{mpb.page eq 'addUser'}" >
						<f:validator validatorId="validators.EmailValidator" disabled="#{not mpb.page eq 'addUser'}"></f:validator>
						<f:validator validatorId="validators.EmailDuplicateValidator" disabled="#{not mpb.page eq 'addUser'}"></f:validator>
					</h:inputText>
				</h:panelGrid>

				<div class="middle">
					<h:commandButton id="back" value="#{msg.OM_newuser_back}" class="button"  immediate="true"
						actionListener="#{manageUserBean.goBackToUsers}">
						<f:ajax render="errors" event="change" execute="back"/>
						</h:commandButton>
					<h:commandButton value="#{msg.OM_newuser_create}" class="button"
						actionListener="#{manageUserBean.createUserActionListener}">
					</h:commandButton>
				</div>

			</h:form>


	
	</ui:define>
</ui:composition>

</html>